<?php
require_once("/home/bluecbhv/Jcuhelpers-WebTech/Common/Algorithms/Content_Scraper.php");
require_once("/home/bluecbhv/Jcuhelpers-WebTech/Keywords_Identifier/Algorithms/DOM_API.php");
require_once("/home/bluecbhv/Jcuhelpers-WebTech/Keywords_Identifier/Algorithms/Keywords_Filter.php");

/***********************************************
	This class would identify the keywords in
	the article.
************************************************/
class KeywordsIdentifier extends KeywordsFilter {
	private $scrapedContent = NULL;
	private $keywordsArray = NULL;
	private $articleKeywords = NULL;
	private $articleKeywordsArray = NULL;
	
	/************************************************************/
	
	function identifyKeywords($link) {
		$this->articleKeywordsArray = array();
		
		$csObj = new ContentScraper();
		$this->scrapedContent = $csObj->scrapeContent($link);
		
		$daObj = new DomApi($this->scrapedContent);
		$this->keywordsArray = $daObj->getArticleKeywords();
		
		foreach ($this->keywordsArray as $keywords) {
			$this->articleKeywords = parent::filterKeywords($keywords->nodeValue);
			
			if ($this->articleKeywords != FALSE) {
				array_push($this->articleKeywordsArray, $this->articleKeywords);
			}
		}

		return $this->articleKeywordsArray;
	}
}
?>